<% if conference.registrations_enabled? %>
  <% if conference.has_registration_for_user_and_registration_type?(current_user, model) %>
    <% if allowed? %>
      <%= button_to conference_registration_type_conference_registration_path(conference, model, locale: current_locale),
                    method: :delete,
                    class: "#{button_classes} bg-success text-white border-transparent conference__registration-button",
                    data: { disable: true } do %>
        <span><%= t("going", scope: "decidim.conferences.conference.show") %></span>
        <%= icon "checkbox-circle-line", class: "w-3.5 h-3.5 fill-current flex-none" %>
      <% end %>
    <% end %>
  <% else %>
    <% if allowed? %>
      <%= button_tag(
          type: "button",
          class: "#{button_classes} conference__registration-button",
          disabled: !conference.has_available_slots? || conference.has_registration_for?(current_user),
          data: { dialog_open: current_user.present? ? "conference-registration-confirm-#{model.id}" : "loginModal" }
        ) do %>
        <span><%= i18n_join_text %></span>
        <%= icon "ticket-line", class: "w-3.5 h-3.5 fill-current flex-none" %>
      <% end %>

      <%= render :registration_confirm %>
    <% end %>
  <% end %>
<% end %>
